﻿* Encoding: UTF-8.

****Border Experiments

FREQUENCIES vars = METERSTOMEX METERSTOCANADA.

FREQUENCIES vars = METERSTOMEX METERSTOCANADA nearestborderus /STATISTICS=MEDIAN.

if (METERSTOMEX gt METERSTOCANADA) nearestborderus=METERSTOCANADA.
if (METERSTOMEX lt METERSTOCANADA) nearestborderus=METERSTOMEX.
recode METERSTOMEX (lo thru 1728760.99146=0) (1728760.99176 thru hi=1) into METERSTOMEX2.
recode METERSTOCANADA (lo thru 664101.16505318=0) (664101.16505319 thru hi =1) into METERSTOCANADA2.

recode nearestborderus (lo thru 413984.35=0) (413984.36 thru hi=1) into nearestborderus2.

compute stdmexdist=ln(meterstomex/7334.80872827344)/ln(4203651.41576815000/7334.8087282734).

descriptives vars =stdmexdist.

***recoding all Dep vars to 0-1 (any country) Calibrated to US Data


FREQUENCIES vars = bilat diffinperception.

compute impressionTaj01=(impressionTaj-1)/6.
compute postimpTaj01= (postimpTaj-1)/6.

compute impressionKyrg01=(impressionKyrg-1)/6.
compute postimpKyrg01=(postimpKyrg-1)/6.

compute bilat01=(bilat-.05)/.95.

compute diffinperception01= (diffinperception+.63)/1.24.

compute strongbordersec01=(strongbordersec-1)/4.

compute strongpersonalsec=mean(kyrgsafety, tajsafety).

compute strongpersonalsec01=(strongpersonalsec-1)/4.


descriptives vars = impressionTaj01 postimpTaj01 impressionKyrg01 postimpKyrg01 bilat01 diffinperception01 strongpersonalsec01 strongbordersec01.


***syntax for US data

**Hypothesis 1 -US test

GLM impressionTaj01 postimpTaj01   BY wallornot  
  /WSFACTOR=prepost 2 Polynomial 
  /METHOD=SSTYPE(3)
  /CRITERIA=ALPHA(.05)
   /emmeans=tables(wallornot)
    /emmeans=tables(wallornot*prepost)
  /WSDESIGN=prepost 
  /DESIGN .


GLM impressionKyrg01 postimpKyrg01   BY wallornot 
  /WSFACTOR=prepost 2 Polynomial 
  /METHOD=SSTYPE(3)
  /CRITERIA=ALPHA(.05)
   /emmeans=tables(wallornot)
    /emmeans=tables(wallornot*prepost)
  /WSDESIGN=prepost 
  /DESIGN.

**Hypothesis 1 -US test withparty2

GLM impressionTaj01 postimpTaj01   BY wallornot party2 
  /WSFACTOR=prepost 2 Polynomial 
  /METHOD=SSTYPE(3)
  /CRITERIA=ALPHA(.05)
   /emmeans=tables(wallornot)
    /emmeans=tables(wallornot*prepost)
     /emmeans=tables(wallornot*party2)
  /WSDESIGN=prepost 
  /DESIGN.


GLM impressionKyrg01 postimpKyrg01   BY wallornot party2 
  /WSFACTOR=prepost 2 Polynomial 
  /METHOD=SSTYPE(3)
  /CRITERIA=ALPHA(.05)
   /emmeans=tables(wallornot)
    /emmeans=tables(wallornot*prepost)
     /emmeans=tables(wallornot*party2)
  /WSDESIGN=prepost 
  /DESIGN.

***Hypothesis 2- us test


GLM bilat01  BY wallornot 
  /METHOD=SSTYPE(3)
  /CRITERIA=ALPHA(.05)
   /emmeans=tables(wallornot)
  /DESIGN.

***Hypothesis 2- us test with party

GLM bilat01  BY wallornot party2 
  /METHOD=SSTYPE(3)
  /CRITERIA=ALPHA(.05)
   /emmeans=tables(wallornot)
        /emmeans=tables(wallornot)
  /DESIGN.




***Hypothesis 3-US higher=Taj gov evaluated more positive if wall built by K


GLM diffinperception01  BY wallbuiltbyK 
  /METHOD=SSTYPE(3)
  /CRITERIA=ALPHA(.05)
   /emmeans=tables(wallbuiltbyK)
  /DESIGN.



**H3 with party 

GLM diffinperception01  BY wallbuiltbyK party2 
  /METHOD=SSTYPE(3)
  /CRITERIA=ALPHA(.05)
   /emmeans=tables(wallbuiltbyK)
   /emmeans=tables(wallbuiltbyK*party2)
  /DESIGN.

***Hypothesis 4, Fig. 4, border and personal security



unianova strongbordersec01 by wallornot
  /METHOD=SSTYPE(3)
  /CRITERIA=ALPHA(.05)
   /emmeans=tables(wallornot)
  /DESIGN .


unianova strongpersonalsec01 by wallornot
  /METHOD=SSTYPE(3)
  /CRITERIA=ALPHA(.05)
   /emmeans=tables(wallornot)
  /DESIGN .

***Data for pooled analyses



compute bothgovts=mean(favorTajgov, favorKyrggov).

compute bothpeeps=mean(favorTajpeople, favorKyrgpeople).

compute bothgovts01=(bothgovts-1)/4.
compute bothpeeps01=(bothpeeps-1)/4.


DESCRIPTIVES vars = bothpeeps01 bothgovts01.

GLM bothgovts01  BY wallornot 
  /METHOD=SSTYPE(3)
  /CRITERIA=ALPHA(.05)
   /emmeans=tables(wallornot)
  /DESIGN.


GLM bothpeeps01  BY wallornot 
  /METHOD=SSTYPE(3)
  /CRITERIA=ALPHA(.05)
   /emmeans=tables(wallornot)
  /DESIGN.


***********************IRELAND

compute Idistance=ln(distancekilometers/1.708108447294260)/ln(9223.372036854777000/1.708108447294260).
execute.

descriptives vars= Idistance.


***How happy or how disappointed are you that the UK voted to leave the EU? Scale from 1 – Extremely disappointed to 10 – Extremely happy

frequencies variables=brexit2_1.
descriptives vars= brexit2_1.


Do if (ireland=1).
recode brexit2_1 (1=1) (14=2) (20=3) (21= 4) (22=5) (23=6) (24=7) (25=8) (26=9) (27=10) into brexit2.
else if (ireland=0).
recode brexit2_1 (1=1) (20=2) (21=3) (10=4) (12=5) (13=6) (14=7) (15=8) (16=9) (17=10) into brexit2.
end if.

FREQUENCIES vars = brexit2.
 
recode brexit2 (1 thru 3=0) (4 thru hi=1) into brexitlohi.

FREQUENCIES vars = brexitlohi.

***recoding all Dep vars to 0-1 (any country) Calibrated to Irish Data

compute impressionTaj01=(impressionTaj-1)/6.
compute postimpTaj01= (postimpTaj-1)/6.

compute impressionKyrg01=(impressionKyrg-1)/6.
compute postimpKyrg01=(postimpKyrg-1)/6.

compute bilat01=(bilat-.05)/.929.

compute diffinperception01= (diffinperception+.36)/1.15.


compute strongbordersec01=(strongbordersec-1)/4.
compute strongpersonalsec=mean(kyrgsafety, tajsafety).
compute strongpersonalsec01=(strongpersonalsec-1)/4.

descriptives vars = impressionTaj01 postimpTaj01 impressionKyrg01 postimpKyrg01 bilat01 diffinperception01 strongbordersec01 strongpersonalsec01.



***Hyp 1 for Ireland


GLM impressionTaj01 postimpTaj01   BY wallornot 
  /WSFACTOR=prepost 2 Polynomial 
  /METHOD=SSTYPE(3)
  /CRITERIA=ALPHA(.05)
   /emmeans=tables(wallornot)
    /emmeans=tables(wallornot*prepost)
  /WSDESIGN=prepost 
  /DESIGN=wallornot .


GLM impressionKyrg01 postimpKyrg01   BY wallornot 
  /WSFACTOR=prepost 2 Polynomial 
  /METHOD=SSTYPE(3)
  /CRITERIA=ALPHA(.05)
   /emmeans=tables(wallornot)
    /emmeans=tables(wallornot*prepost)
  /WSDESIGN=prepost 
  /DESIGN=wallornot.

***Hyp 1 with brexit

GLM impressionTaj01 postimpTaj01   BY wallornot brexitlohi
  /WSFACTOR=prepost 2 Polynomial 
  /METHOD=SSTYPE(3)
  /CRITERIA=ALPHA(.05)
   /emmeans=tables(wallornot)
    /emmeans=tables(wallornot*prepost)
     /emmeans=tables(wallornot*brexitlohi)
  /WSDESIGN=prepost 
  /DESIGN=wallornot brexitlohi wallornot*brexitlohi.


GLM impressionKyrg01 postimpKyrg01   BY wallornot brexitlohi
  /WSFACTOR=prepost 2 Polynomial 
  /METHOD=SSTYPE(3)
  /CRITERIA=ALPHA(.05)
   /emmeans=tables(wallornot)
    /emmeans=tables(wallornot*prepost)
     /emmeans=tables(wallornot*brexitlohi)
  /WSDESIGN=prepost 
  /DESIGN=wallornot brexitlohi wallornot*brexitlohi.

 
***Hypothesis 2- Ireland

GLM bilat01  BY wallornot 
  /METHOD=SSTYPE(3)
  /CRITERIA=ALPHA(.05)
   /emmeans=tables(wallornot)
  /DESIGN=wallornot.


GLM bilat01  BY wallornot brexitlohi
  /METHOD=SSTYPE(3)
  /CRITERIA=ALPHA(.05)
   /emmeans=tables(wallornot)
     /emmeans=tables(wallornot*brexitlohi)
  /DESIGN.


***Hypothesis 3-Ireland; higher=Taj morepositive if built by K


GLM diffinperception01  BY wallbuiltbyK
  /METHOD=SSTYPE(3)
  /CRITERIA=ALPHA(.05)
   /emmeans=tables(wallbuiltbyK)
  /DESIGN.


GLM diffinperception01  BY wallbuiltbyK brexitlohi
  /METHOD=SSTYPE(3)
  /CRITERIA=ALPHA(.05)
   /emmeans=tables(wallbuiltbyK)
    /emmeans=tables(wallbuiltbyK*brexitlohi)
  /DESIGN.

***Hyp 4 for ireland


unianova strongbordersec01 by wallornot
  /METHOD=SSTYPE(3)
  /CRITERIA=ALPHA(.05)
   /emmeans=tables(wallornot)
  /DESIGN .


unianova strongpersonalsec01 by wallornot
  /METHOD=SSTYPE(3)
  /CRITERIA=ALPHA(.05)
   /emmeans=tables(wallornot)
  /DESIGN .

*****Data for pooled analyses


compute bothgovts=mean(favorTajgov, favorKyrggov).

compute bothpeeps=mean(favorTajpeople, favorKyrgpeople).

compute bothgovts01=(bothgovts-1)/4.
compute bothpeeps01=(bothpeeps-1)/4.


DESCRIPTIVES vars = bothpeeps01 bothgovts01.

GLM bothgovts01  BY wallornot 
  /METHOD=SSTYPE(3)
  /CRITERIA=ALPHA(.05)
   /emmeans=tables(wallornot)
  /DESIGN.


GLM bothpeeps01  BY wallornot 
  /METHOD=SSTYPE(3)
  /CRITERIA=ALPHA(.05)
   /emmeans=tables(wallornot)
  /DESIGN.

*************************TURKEY


***recoding all Dep vars to 0-1 (any country) Calibrated to Turkish Data


compute impressionTaj01=(impressionTaj-1)/6.
compute postimpTaj01= (postimpTaj-1)/6.

compute impressionKyrg01=(impressionKyrg-1)/6.
compute postimpKyrg01=(postimpKyrg-1)/6.

compute bilat01=(bilat-.05)/.95.

compute diffinperception01= (diffinperception+.55)/1.22.

compute strongbordersec01=(strongbordersec-1)/4.

compute strongpersonalsec=mean(kyrgsafety, tajsafety).
compute strongpersonalsec01=(strongpersonalsec-1)/4.

descriptives vars = impressionTaj01 postimpTaj01 impressionKyrg01 postimpKyrg01 bilat01 diffinperception01 compute strongbordersec01 strongpersonalsec01.

***Hyp 1 for TURKEY


GLM impressionTaj01 postimpTaj01   BY wallornot 
  /WSFACTOR=prepost 2 Polynomial 
  /METHOD=SSTYPE(3)
  /CRITERIA=ALPHA(.05)
   /emmeans=tables(wallornot)
     /emmeans=tables(prepost)
    /emmeans=tables(wallornot*prepost)
  /WSDESIGN=prepost 
  /DESIGN=wallornot.


GLM impressionKyrg01 postimpKyrg01   BY wallornot 
  /WSFACTOR=prepost 2 Polynomial 
  /METHOD=SSTYPE(3)
  /CRITERIA=ALPHA(.05)
   /emmeans=tables(wallornot)
    /emmeans=tables(wallornot*prepost)
  /WSDESIGN=prepost 
  /DESIGN=wallornot.

***Turkey with party equiv?


***Hypothesis 2- Turkey

GLM bilat01  BY wallornot 
  /METHOD=SSTYPE(3)
  /CRITERIA=ALPHA(.05)
   /emmeans=tables(wallornot)
  /DESIGN=wallornot.




***Hypothesis 3-TURKEY; higher=Taj morepositive if built by K

GLM diffinperception01  BY wallbuiltbyK
  /METHOD=SSTYPE(3)
  /CRITERIA=ALPHA(.05)
   /emmeans=tables(wallbuiltbyK)
  /DESIGN.





***H4 for Turkey


unianova strongbordersec01 by wallornot
  /METHOD=SSTYPE(3)
  /CRITERIA=ALPHA(.05)
   /emmeans=tables(wallornot)
  /DESIGN .


unianova strongpersonalsec01 by wallornot
  /METHOD=SSTYPE(3)
  /CRITERIA=ALPHA(.05)
   /emmeans=tables(wallornot)
  /DESIGN .

***Data for pooled analyses

FREQUENCIES vars = q13 q16.
recode q13 (1=5) (5=1) (4=2) (2=4) (3=3) into favorTajpeople.
recode q16 (1=5) (5=1) (4=2) (2=4) (3=3) into favorKyrgpeople.

compute bothgovts=mean(favorTajgov, favorKyrggov).

compute bothpeeps=mean(favorTajpeople, favorKyrgpeople).

compute bothgovts01=(bothgovts-1)/4.
compute bothpeeps01=(bothpeeps-1)/4.


DESCRIPTIVES vars = bothpeeps01 bothgovts01.

GLM bothgovts01  BY wallornot 
  /METHOD=SSTYPE(3)
  /CRITERIA=ALPHA(.05)
   /emmeans=tables(wallornot)
  /DESIGN.


GLM bothpeeps01  BY wallornot 
  /METHOD=SSTYPE(3)
  /CRITERIA=ALPHA(.05)
   /emmeans=tables(wallornot)
  /DESIGN.



